#ifndef POINT3F_H
#define POINT3F_H

#pragma once

#include <LDF/LargeDisplayFrameworkLayer.h>

/**
 * This class represents a 3D point with float values.
 *
 * @author Fabricio Anastacio - fabriciocfa@yahoo.com
 * @since June 26, 2007
 */
class LARGEDISPLAYFRAMEWORKLAYER_API Point3f
{
	// Attributes
public:
	/** The x-coordinate of this point. */
	float x;
	/** The y-coordinate of this point. */
	float y;
	/** The z-coordinate of this point. */
	float z;

	// Methods
public:
	/**
	 * Constructs a 3D point with float elements with initial value equal to zero.
	 */
	Point3f(void);
	/**
	 * Constructs a 3D point with float values as given by the arguments.
	 *
	 * @param ax the x-coordinate value.
	 * @param ay the y-coordinate value.
	 * @param az the z-coordinate value.
	 */
	Point3f(float ax, float ay, float az);
	/**
	 * Destroys this point object.
	 */
	~Point3f(void);

	/**
	 * Assignment operator.
	 *
	 * @param p the Point3f object whose values will be assigned to this one.
	 */
	Point3f& operator=(const Point3f& p) {
		x = p.x;
		y = p.y;
		z = p.z;
		return *this;
	}

	// ARITHMETICAL OPERATORS
	/**
	 * Adds the point p to the current point.
	 *
	 * @param p the point to be added to this one.
	 */
	inline Point3f& operator+=(const Point3f& p) {
		x += p.x;
		y += p.y;
		z += p.z;
		return *this;
	};
	/**
	 * Multiples this point by the value s.
	 *
	 * @param s the value to be multiplied by this points.
	 */
	inline Point3f& operator*=(float s) {
		x *= s;
		y *= s;
		z *= s;
		return *this;
	};
	/**
	 * Returns the result of adding the point p to the current point.
	 *
	 * @param p the point to be added to this one.
	 * @return the resulting of adding this point to p.
	 */
	inline Point3f operator+(const Point3f& p) const {
		Point3f r = *this;
		r += p;
		return r;
	};
	/**
	 * Returns the result of multiplying this point by the scalar s.
	 *
	 * @param s the scalar value to multiplied by this point.
	 * @return the resulting of multiplying this point by s.
	 */
	inline Point3f operator*(float s) const {
		Point3f r = *this;
		r *= s;
		return r;
	};


	/**
	 * Converts the contents of this point into an array of 3 floats.
	 *
	 * @param arrayPoint the array of 3 floats where the contents of this point
	 * will be placed.
	 */
	inline void convertToArray(float* arrayPoint) {
		arrayPoint[0] = x; arrayPoint[1] = y; arrayPoint[2] = z;
	};


	// DEBUGGING
	/**
	 * Prints this point on the console for debugging purposes.
	 */
	void print();
};

#endif // POINT3F_H
